package com.example.back.controller;

import com.example.back.dto.req.GetHospitalDataReq;
import com.example.back.dto.req.GetServiceDataReq;
import com.example.back.dto.resp.GetDataRsp;
import com.example.back.dto.resp.GetHospitalDataRsp;
import com.example.back.dto.resp.GetServiceDataResp;
import com.example.back.service.MainService;
import com.example.common.support.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wxy
 * @Date 2021/1/13 13:20
 * @Version 1.0
 */
@RestController
@Api(tags = "首页")
@RequestMapping("/api/Main")
public class MainController {
    @Resource
    private MainService mainService;

    @ApiOperation(value = "疾病列表", notes = "疾病列表")
    @PostMapping(value = "/GetData")
    public Result<GetDataRsp> GetData() {
        return Result.success(mainService.GetData());
    }

    @ApiOperation(value = "GetHospitalData", notes = "GetHospitalData")
    @PostMapping(value = "/GetHospitalData")
    public Result<GetHospitalDataRsp> GetHospitalData(@RequestBody GetHospitalDataReq getHospitalDataReq) {
        return Result.success(mainService.GetHospitalData(getHospitalDataReq));
    }

    @ApiOperation(value = "服务统计", notes = "服务统计")
    @PostMapping(value = "/GetServiceData")
    public Result<List<GetServiceDataResp>> GetServiceData(@RequestBody GetServiceDataReq req) {
        return Result.success(mainService.GetServiceData(req));
    }

}
